package com.bilgeadam.swing.view;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author Bora SAYINER
 * @since Dec 20, 2014 1:09:37 PM
 * @version 1.0
 */
public class MainFrame {

	private JFrame frmMain;
	private String userName;

	public MainFrame() {
		this("Unknown");
	}

	public MainFrame(String userName) {
		this.userName = userName;
		initializeComponents();
	}

	private void initializeComponents() {
		this.frmMain = new JFrame();
		frmMain.setTitle("Main Frame");
		frmMain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frmMain.setExtendedState(JFrame.MAXIMIZED_BOTH);
		{
			JPanel pnlCenter = new JPanel();
			{
				JLabel lblUserName = new JLabel(String.format("Welcome, %s", userName));
				pnlCenter.add(lblUserName);
			}
			frmMain.add(pnlCenter, BorderLayout.CENTER);
		}
	}

	public void setVisible(boolean visible) {
		frmMain.setVisible(visible);
	}
}
